//
//  publicWebViewController.m
//  ILiangCang
//
//  Created by ZX on 16-4-21.
//  Copyright (c) 2016年 CRQ. All rights reserved.
//

#import "publicWebViewController.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
@interface publicWebViewController ()
@property (nonatomic,strong)UIView * navView;

@end

@implementation publicWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.navigationController.navigationBarHidden = YES;
    [self addNavView];
        
    
    UIWebView * webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 64, WIDTH, HEIGHT-64)];
    NSURLRequest * request = [NSURLRequest requestWithURL:_url];
    [webView loadRequest:request];
    [self.view addSubview:webView];
    
    
    
    
}

-(void)addNavView
{
    _navView = [[UIView alloc]init];
    _navView.frame = CGRectMake(0, 0, WIDTH, 64);
    [self.view addSubview:_navView];
    UIImageView * navBG = [[UIImageView alloc]init];
    navBG.frame = CGRectMake(0, 0, WIDTH, 64);
    navBG.image = [UIImage imageNamed:@"nav_bar"];
    [_navView addSubview:navBG];
    UIButton * menuBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    menuBtn.frame = CGRectMake(6, 20, 36, 36);
    [menuBtn setBackgroundImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
    [menuBtn addTarget:self action:@selector(menuBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [_navView addSubview:menuBtn];
    
//    UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//    rightBtn.frame = CGRectMake(10, 24, 34, 34);
//    rightBtn.tag = 1;
//    [rightBtn setBackgroundImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
//    [rightBtn addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];
//    [_navView addSubview:rightBtn];
}


-(void)menuBtnClick:(UIButton *)sender
{
    [self.navigationController popToRootViewControllerAnimated:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
